package com.yyj.jan.user.service;

import com.yyj.jan.user.dao.UserDao;
import com.yyj.jan.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
    public User findOne(String id) {
        return userDao.getOne(id);
    }

    @Override
    public User findOneByName(String name) {
        return null;
    }

    @Override
    public List<User> findUserLikeName(String name) {
        return null;
    }

    @Override
    public void add(User user) {
        userDao.save(user);
    }
    @Override
    @Modifying
    @Transactional()
    public void delete(String id) {
        userDao.deleteById(id);
    }

    @Override
    public void update(User user) {

    }
}
